package com.example.demo.controller;

import com.example.demo.entity.User;
import com.example.demo.service.IUserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 *  users接口
 * </p>
 *
 * @author yolo
 * @since 2025-03-20
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private IUserService userService;

    @GetMapping("list")
    public List<User> list(){
        return userService.list();
    }

    @PostMapping("register")
    public String register(@RequestParam("username") String username, @RequestParam("password") String password){
        return userService.register(username, password);
    }

}
